﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BLFacade.entities;
using BLFacade.enums;

namespace BL
{
    public partial class Project : IProject
    {

        public IEmployee ProjectManager
        {
            get
            {
                return (IEmployee)Employee;
            }
            set
            {
                Employee = (Employee)value;
            }
        }

        ICustomer IProject.Customer
        {
            get
            {
                return (ICustomer)Customer;
            }
            set
            {
                Customer = (Customer)value;
            }
        }

        List<ITask> IProject.Tasks
        {
            get { return Tasks.ToList<ITask>(); }
        }

        public ITask CreateTask(string name, string description, int loe, int priority, IEmployee employee)
        {
            Task task = new Task()
            {
                Name = name,
                Description = description,
                LOE = loe,
                Priority = priority,
                Status = (int)TaskStatus.Opened,
                CreateDate = DateTime.Now,
                Employee = (Employee)employee
            };
            Tasks.Add(task);
            return task;
        }


        public void Start()
        {
            StartDate = DateTime.Now;
        }

        public void Close()
        {
            EndDate = DateTime.Now;
        }
    }
}
